<template>
  <d2-container>
    <el-table
      :data="tableData"
      style="width: 100%"
      v-loading="loading"
      element-loading-text="拼命加载中"
      max-height="400">
      <el-table-column
        fixed
        prop="departId"
        label="编号"
        width="150">
      </el-table-column>
      <el-table-column
        prop="departName"
        label="登记号"
        width="120">
      </el-table-column>
      <el-table-column
        prop="departCode"
        label="委托单好"
        width="120">
      </el-table-column>
      <el-table-column
        prop="departShortName"
        label="委托单位"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="器具名称"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="套数"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="受理日期"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="检测日期"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="证书状态"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="库房状态"
        width="120">
      </el-table-column>
      <el-table-column
        prop="businessType"
        label="合同号"
        width="120">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        width="220">
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="handleEdit(scope.$index, scope.row)"
            type="text"
            size="small">
            费用录入
          </el-button>
          <el-button
            @click.native.prevent="handleEdit(scope.$index, scope.row)"
            type="text"
            size="small">
            编制记录
          </el-button>
          <el-button
            @click.native.prevent="handleEdit(scope.$index, scope.row)"
            type="text"
            size="small">
            编制证书
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="20"
        layout="total, prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>
  </d2-container>
</template>

<script>
import api from '@/api'
export default {
  name: 'main-task-list',
  created () {
    this.getData()
  },
  methods: {
    async getData () {
      this.loading = true
      var data = await api.OA_DEPARTMEN_LIST({
        pageNo: 1,
        pageSize: 10
      })
      this.loading = false
      this.count = data.count
      this.tableData = data.list
    },
    handleCurrentChange (val) {
      this.currentPage = val
      console.log(`当前页: ${val}`)
    }
  },
  data () {
    return {
      loading: false,
      departId: 0,
      tableData: [],
      currentPage: 1,
      count: 0
    }
  }
}
</script>
